package com.bw.z.utils;

import android.content.SharedPreferences;

import com.bw.z.App;

public class SpUtils {
    private static String name = "paper";

    public static void saveData(String key, String value) {
        SharedPreferences sp = App.getInstance().getApplicationContext().getSharedPreferences(name, 0);
        sp.edit().putString(key, value).commit();
    }

    public static String readData(String key ) {
        SharedPreferences sp = App.getInstance().getApplicationContext().getSharedPreferences(name, 0);
        return sp.getString(key, "");
    }

    public static void saveDataLong(String key, long l) {
        SharedPreferences sp = App.getInstance().getApplicationContext().getSharedPreferences(name, 0);
        sp.edit().putLong(key, l).commit();
    }

    public static Long readDataLong(String key) {
        SharedPreferences sp = App.getInstance().getApplicationContext().getSharedPreferences(name, 0);
        return sp.getLong(key, 0l);
    }
}
